﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;

public partial class SuppleMent_Controls_ShangpinList : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    public event RepeaterCommandEventHandler ItemCommand;
    private string spdm;
    public string SPDM
    {
        get
        {
            if (ViewState["SPDM"] != null)
            {
                spdm = ViewState["SPDM"].ToString();
            }
            return spdm;
        }
        set
        {
            ViewState["SPDM"] = value;
        }
    }
    public List<string> Selected
    {
        get
        {
            List<string> l = new List<string>();
            foreach (RepeaterItem item in rptCommAppList.Items)
            {
                CheckBox cb = item.FindControl("chkChoose") as CheckBox;
                if (cb != null && cb.Checked)
                {
                    HiddenField fld = item.FindControl("hfCommApp") as HiddenField;
                    if (fld != null)
                    {
                        string id = fld.Value;
                        if (id != SPDM)
                        {
                            l.Add(id);
                        }
                    }
                }
            }
            return l;
        }
    }
    protected void CommAppList_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if (ItemCommand != null)
        {
            ItemCommand(source, e);
        }
    }
    public void Bind(DataTable dt)
    {
        rptCommAppList.DataSource = dt.DefaultView;
        rptCommAppList.DataBind();
    }
}
